package headfirst.singleton.subclass;

/**
 * 通过静态变量来创建单例
 */
public class Singleton {
    protected static Singleton uniqueInstance;

    protected Singleton() {
    }

    public static synchronized Singleton getInstance() {
        if (uniqueInstance == null) {
            uniqueInstance = new Singleton();
        }
        return uniqueInstance;
    }
}
